6ea7f5d26b622c0cd2ff31a2cfb2effd331ebafe,clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java,WalrusManager,putObject,#PutObjectType#,559

Before Change


							dbObject = WalrusControl.getEntityWrapper();
							objectInfos = dbObject.query(new ObjectInfo(bucketName, objectKey));
							if(objectInfos.size() > 0) {
								foundObject = objectInfos.get(0);
								foundObject.setEtag(md5);
								foundObject.setSize(size);
								foundObject.setLastModified(lastModified);
								foundObject.setStorageClass("STANDARD");
								foundObject.setContentType(request.getContentType());

After Change


							lastModified = new Date();
							long oldObjectSize = 0L;
							dbObject = WalrusControl.getEntityWrapper();
							searchObject = new ObjectInfo(bucketName, objectKey);
							ObjectInfo foundObject;
							try {
								foundObject = dbObject.getUnique(searchObject);
								if (foundObject.canWriteACP(userId)) {
									List<GrantInfo> grantInfos = new ArrayList<GrantInfo>();
									foundObject.addGrants(userId, grantInfos,
											accessControlList);
									foundObject.setGrants(grantInfos);
								}
								oldObjectSize = foundObject.getSize();
								if(WalrusProperties.enableTorrents) {
									EntityWrapper<TorrentInfo> dbTorrent = db.recast(TorrentInfo.class);
									TorrentInfo torrentInfo = new TorrentInfo(bucketName, objectKey);
									List<TorrentInfo> torrentInfos = dbTorrent.query(torrentInfo);
									if(torrentInfos.size() > 0) {
										TorrentInfo foundTorrentInfo = torrentInfos.get(0);
										TorrentClient torrentClient = Torrents.getClient(bucketName + objectKey);
										if(torrentClient != null) {
											torrentClient.bye();
										}
										dbTorrent.delete(foundTorrentInfo);
									}
								} else {
									LOG.warn("Bittorrent support has been disabled. Please check pre-requisites");
								}
							} catch (EucalyptusCloudException ex) {
								if(objectInfo != null) {
									foundObject = objectInfo;
								} else {
									db.rollback();
									throw new EucalyptusCloudException("Unable to update object: " + bucketName + "/" + objectKey);
								}
							}
							foundObject.setEtag(md5);
							foundObject.replaceMetaData(request.getMetaData());
							foundObject.setSize(size);
							foundObject.setLastModified(lastModified);
							foundObject.setStorageClass("STANDARD");
							foundObject.setContentType(request.getContentType());